home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / emacs-complete / fsf / emacs / info / emacs-12 < prev    next >
Encoding:
GNU Info File  |  1994-10-06  |  46.5 KB  |  1,101 lines

  1. This is Info file ../info/emacs, produced by Makeinfo-1.54 from the
  2. input file emacs.texi.
  3.  
  4. 
  5. File: emacs,  Node: GUD Customization,  Prev: Commands of GUD,  Up: Debuggers
  6.  
  7. GUD Customization
  8. -----------------
  9.  
  10.    On startup, GUD runs one of the following hooks: `gdb-mode-hook', if
  11. you are using GDB; `dbx-mode-hook', if you are using DBX;
  12. `sdb-mode-hook', if you are using SDB; `xdb-mode-hook', if you are
  13. using XDB; `perldb-mode-hook', for Perl debugging mode.  You can use
  14. these hooks to define custom key bindings for the debugger interaction
  15. buffer.  *Note Hooks::.
  16.  
  17.    Here is a convenient way to define a command that sends a particular
  18. command string to the debugger, and set up a key binding for it in the
  19. debugger interaction buffer:
  20.  
  21.      (gud-def FUNCTION CMDSTRING BINDING DOCSTRING)
  22.  
  23.    This defines a command named FUNCTION which sends CMDSTRING to the
  24. debugger process, and gives it the documentation string DOCSTRING.  You
  25. can use the command thus defined in any buffer.  If BINDING is
  26. non-`nil', `gud-def' also binds the command to `C-c BINDING' in the GUD
  27. buffer's mode and to `C-x C-a BINDING' generally.
  28.  
  29.    The command string CMDSTRING may contain certain `%'-sequences that
  30. stand for data to be filled in at the time FUNCTION is called:
  31.  
  32. `%f'
  33.      The name of the current source file.  If the current buffer is the
  34.      GUD buffer, then the "current source file" is the file that the
  35.      program stopped in.
  36.  
  37. `%l'
  38.      The number of the current source line.  If the current buffer is
  39.      the GUD buffer, then the "current source line" is the line that
  40.      the program stopped in.
  41.  
  42. `%e'
  43.      The text of the C lvalue or function-call expression at or
  44.      adjacent to point.
  45.  
  46. `%a'
  47.      The text of the hexadecimal address at or adjacent to point.
  48.  
  49. `%p'
  50.      The numeric argument of the called function, as a decimal number.
  51.      If the command is used without a numeric argument, `%p' stands for
  52.      the empty string.
  53.  
  54.      If you don't use `%p' in the command string, the command you define
  55.      ignores any numeric argument.
  56.  
  57. 
  58. File: emacs,  Node: Executing Lisp,  Next: Lisp Libraries,  Prev: Debuggers,  Up: Building
  59.  
  60. Executing Lisp Expressions
  61. ==========================
  62.  
  63.    Emacs has several different major modes for Lisp and Scheme.  They
  64. are the same in terms of editing commands, but differ in the commands
  65. for executing Lisp expressions.  Each mode has its own purpose.
  66.  
  67. Emacs-Lisp mode
  68.      The mode for editing source files of programs to run in Emacs Lisp.
  69.      This mode defines `C-M-x' to evaluate the current defun.  *Note
  70.      Lisp Libraries::.
  71.  
  72. Lisp Interaction mode
  73.      The mode for an interactive session with Emacs Lisp.  It defines
  74.      LFD to evaluate the sexp before point and insert its value in the
  75.      buffer.  *Note Lisp Interaction::.
  76.  
  77. Lisp mode
  78.      The mode for editing source files of programs that run in Lisps
  79.      other than Emacs Lisp.  This mode defines `C-M-x' to send the
  80.      current defun to an inferior Lisp process.  *Note External Lisp::.
  81.  
  82. Inferior Lisp mode
  83.      The mode for an interactive session with an inferior Lisp process.
  84.      This mode combines the special features of Lisp mode and Shell mode
  85.      (*note Shell Mode::.).
  86.  
  87. Scheme mode
  88.      Like Lisp mode but for Scheme programs.
  89.  
  90. Inferior Scheme mode
  91.      The mode for an interactive session with an inferior Scheme
  92.      process.
  93.  
  94. * Menu:
  95.  
  96. These subnodes of the chapter on editing programs describe the editing
  97. commands for working with Lisp programs, which are in fact available
  98. globally.
  99.  
  100. * Lists::          Expressions with balanced parentheses.
  101. * List Commands::     The commands for working with list and sexps.
  102. * Defuns::          Each program is made up of separate functions.
  103.             There are editing commands to operate on them.
  104. * Program Indent::    Adjusting indentation to show the nesting.
  105. * Matching::          Insertion of a close-delimiter flashes matching open.
  106. * Comments::          Inserting, killing, and aligning comments.
  107.  
  108. 
  109. File: emacs,  Node: Lisp Libraries,  Next: Lisp Interaction,  Prev: Executing Lisp,  Up: Building
  110.  
  111. Libraries of Lisp Code for Emacs
  112. ================================
  113.  
  114.    Lisp code for Emacs editing commands is stored in files whose names
  115. conventionally end in `.el'.  This ending tells Emacs to edit them in
  116. Emacs-Lisp mode (*note Executing Lisp::.).
  117.  
  118.    To execute a file of Emacs Lisp code, use `M-x load-file'.  This
  119. command reads a file name using the minibuffer and then executes the
  120. contents of that file as Lisp code.  It is not necessary to visit the
  121. file first; in any case, this command reads the file as found on disk,
  122. not text in an Emacs buffer.
  123.  
  124.    Once a file of Lisp code is installed in the Emacs Lisp library
  125. directories, users can load it using `M-x load-library'.  Programs can
  126. load it by calling `load-library', or with `load', a more primitive
  127. function that is similar but accepts some additional arguments.
  128.  
  129.    `M-x load-library' differs from `M-x load-file' in that it searches
  130. a sequence of directories and tries three file names in each directory.
  131. Suppose your argument is LIB; the three names are `LIB.elc', `LIB.el',
  132. and lastly just `LIB'.  If `LIB.elc' exists, it is by convention the
  133. result of compiling `LIB.el'; it is better to load the compiled file,
  134. since it will load and run faster.
  135.  
  136.    If `load-library' finds that `LIB.el' is newer than `LIB.elc' file,
  137. it prints a warning, because it's likely that somebody made changes to
  138. the `.el' file and forgot to recompile it.
  139.  
  140.    Because the argument to `load-library' is usually not in itself a
  141. valid file name, file name completion is not available.  Indeed, when
  142. using this command, you usually do not know exactly what file name will
  143. be used.
  144.  
  145.    The sequence of directories searched by `M-x load-library' is
  146. specified by the variable `load-path', a list of strings that are
  147. directory names.  The default value of the list contains the directory
  148. where the Lisp code for Emacs itself is stored.  If you have libraries
  149. of your own, put them in a single directory and add that directory to
  150. `load-path'.  `nil' in this list stands for the current default
  151. directory, but it is probably not a good idea to put `nil' in the list.
  152. If you find yourself wishing that `nil' were in the list, most likely
  153. what you really want to do is use `M-x load-file' this once.
  154.  
  155.    Often you do not have to give any command to load a library, because
  156. the commands defined in the library are set up to "autoload" that
  157. library.  Trying to run any of those commands calls `load' to load the
  158. library; this replaces the autoload definitions with the real ones from
  159. the library.
  160.  
  161.    Emacs Lisp code can be compiled into byte-code which loads faster,
  162. takes up less space when loaded, and executes faster.  *Note Byte
  163. Compilation: (elisp)Byte Compilation.  By convention, the compiled code
  164. for a library goes in a separate file whose name consists of the
  165. library source file with `c' appended.  Thus, the compiled code for
  166. `foo.el' goes in `foo.elc'.  That's why `load-library' searches for
  167. `.elc' files first.
  168.  
  169. 
  170. File: emacs,  Node: Lisp Eval,  Next: External Lisp,  Prev: Lisp Interaction,  Up: Building
  171.  
  172. Evaluating Emacs-Lisp Expressions
  173. =================================
  174.  
  175.    Lisp programs intended to be run in Emacs should be edited in
  176. Emacs-Lisp mode; this happens automatically for file names ending in
  177. `.el'.  By contrast, Lisp mode itself is used for editing Lisp programs
  178. intended for other Lisp systems.  To switch to Emacs-Lisp mode
  179. explicitly, use the command `M-x emacs-lisp-mode'.
  180.  
  181.    For testing of Lisp programs to run in Emacs, it is often useful to
  182. evaluate part of the program as it is found in the Emacs buffer.  For
  183. example, after changing the text of a Lisp function definition,
  184. evaluating the definition installs the change for future calls to the
  185. function.  Evaluation of Lisp expressions is also useful in any kind of
  186. editing, for invoking noninteractive functions (functions that are not
  187. commands).
  188.  
  189. `M-ESC'
  190.      Read a single Lisp expression in the minibuffer, evaluate it, and
  191.      print the value in the echo area (`eval-expression').
  192.  
  193. `C-x C-e'
  194.      Evaluate the Lisp expression before point, and print the value in
  195.      the echo area (`eval-last-sexp').
  196.  
  197. `C-M-x'
  198.      Evaluate the defun containing or after point, and print the value
  199.      in the echo area (`eval-defun').
  200.  
  201. `M-x eval-region'
  202.      Evaluate all the Lisp expressions in the region.
  203.  
  204. `M-x eval-current-buffer'
  205.      Evaluate all the Lisp expressions in the buffer.
  206.  
  207.    `M-ESC' (`eval-expression') is the most basic command for evaluating
  208. a Lisp expression interactively.  It reads the expression using the
  209. minibuffer, so you can execute any expression on a buffer regardless of
  210. what the buffer contains.  When the expression is evaluated, the current
  211. buffer is once again the buffer that was current when `M-ESC' was typed.
  212.  
  213.    `M-ESC' can easily confuse users who do not understand it,
  214. especially on keyboards with autorepeat where it can result from holding
  215. down the ESC key for too long.  Therefore, `eval-expression' is
  216. normally a disabled command.  Attempting to use this command asks for
  217. confirmation and gives you the option of enabling it; once you enable
  218. the command, confirmation will no longer be required for it.  *Note
  219. Disabling::.
  220.  
  221.    In Emacs-Lisp mode, the key `C-M-x' is bound to the command
  222. `eval-defun', which parses the defun containing or following point as a
  223. Lisp expression and evaluates it.  The value is printed in the echo
  224. area.  This command is convenient for installing in the Lisp environment
  225. changes that you have just made in the text of a function definition.
  226.  
  227.    The command `C-x C-e' (`eval-last-sexp') performs a similar job but
  228. is available in all major modes, not just Emacs-Lisp mode.  It finds
  229. the sexp before point, reads it as a Lisp expression, evaluates it, and
  230. prints the value in the echo area.  It is sometimes useful to type in an
  231. expression and then, with point still after it, type `C-x C-e'.
  232.  
  233.    If `C-M-x' or `C-x C-e' is given a numeric argument, it inserts the
  234. value into the current buffer at point, rather than displaying it in
  235. the echo area.  The argument's value does not matter.
  236.  
  237.    The most general command for evaluating Lisp expressions from a
  238. buffer is `eval-region'.  `M-x eval-region' parses the text of the
  239. region as one or more Lisp expressions, evaluating them one by one.
  240. `M-x eval-current-buffer' is similar but evaluates the entire buffer.
  241. This is a reasonable way to install the contents of a file of Lisp code
  242. that you are just ready to test.  Later, as you find bugs and change
  243. individual functions, use `C-M-x' on each function that you change.
  244. This keeps the Lisp world in step with the source file.
  245.  
  246. 
  247. File: emacs,  Node: Lisp Interaction,  Next: Lisp Eval,  Prev: Lisp Libraries,  Up: Building
  248.  
  249. Lisp Interaction Buffers
  250. ========================
  251.  
  252.    The buffer `*scratch*' which is selected when Emacs starts up is
  253. provided for evaluating Lisp expressions interactively inside Emacs.
  254.  
  255.    The simplest way to use the `*scratch*' buffer is to insert Lisp
  256. expressions and type LFD after each expression.  This command reads the
  257. Lisp expression before point, evaluates it, and inserts the value in
  258. printed representation before point.  The result is a complete
  259. typescript of the expressions you have evaluated and their values.
  260.  
  261.    The `*scratch*' buffer's major mode is Lisp Interaction mode, which
  262. is the same as Emacs-Lisp mode except for the binding of LFD.
  263.  
  264.    The rationale for this feature is that Emacs must have a buffer when
  265. it starts up, but that buffer is not useful for editing files since a
  266. new buffer is made for every file that you visit.  The Lisp interpreter
  267. typescript is the most useful thing I can think of for the initial
  268. buffer to do.  Type `M-x lisp-interaction-mode' to put the current
  269. buffer in Lisp Interaction mode.
  270.  
  271. 
  272. File: emacs,  Node: External Lisp,  Prev: Lisp Eval,  Up: Building
  273.  
  274. Running an External Lisp
  275. ========================
  276.  
  277.    Emacs has facilities for running programs in other Lisp systems.
  278. You can run a Lisp process as an inferior of Emacs, and pass
  279. expressions to it to be evaluated.  You can also pass changed function
  280. definitions directly from the Emacs buffers in which you edit the Lisp
  281. programs to the inferior Lisp process.
  282.  
  283.    To run an inferior Lisp process, type `M-x run-lisp'.  This runs the
  284. program named `lisp', the same program you would run by typing `lisp'
  285. as a shell command, with both input and output going through an Emacs
  286. buffer named `*lisp*'.  That is to say, any "terminal output" from Lisp
  287. will go into the buffer, advancing point, and any "terminal input" for
  288. Lisp comes from text in the buffer.  (You can change the name of the
  289. Lisp executable file by setting the variable `inferior-lisp-program'.)
  290.  
  291.    To give input to Lisp, go to the end of the buffer and type the
  292. input, terminated by RET.  The `*lisp*' buffer is in Inferior Lisp
  293. mode, which combines the special characteristics of Lisp mode with most
  294. of the features of Shell mode (*note Shell Mode::.).  The definition of
  295. RET to send a line to a subprocess is one of the features of Shell mode.
  296.  
  297.    For the source files of programs to run in external Lisps, use Lisp
  298. mode.  This mode can be selected with `M-x lisp-mode', and is used
  299. automatically for files whose names end in `.l', `.lsp', or `.lisp', as
  300. most Lisp systems usually expect.
  301.  
  302.    When you edit a function in a Lisp program you are running, the
  303. easiest way to send the changed definition to the inferior Lisp process
  304. is the key `C-M-x'.  In Lisp mode, this runs the function
  305. `lisp-eval-defun', which finds the defun around or following point and
  306. sends it as input to the Lisp process.  (Emacs can send input to any
  307. inferior process regardless of what buffer is current.)
  308.  
  309.    Contrast the meanings of `C-M-x' in Lisp mode (for editing programs
  310. to be run in another Lisp system) and Emacs-Lisp mode (for editing Lisp
  311. programs to be run in Emacs): in both modes it has the effect of
  312. installing the function definition that point is in, but the way of
  313. doing so is different according to where the relevant Lisp environment
  314. is found.  *Note Executing Lisp::.
  315.  
  316. 
  317. File: emacs,  Node: Abbrevs,  Next: Picture,  Prev: Building,  Up: Top
  318.  
  319. Abbrevs
  320. *******
  321.  
  322.    A defined "abbrev" is a word which "expands", if you insert it, into
  323. some different text.  Abbrevs are defined by the user to expand in
  324. specific ways.  For example, you might define `foo' as an abbrev
  325. expanding to `find outer otter'.  Then you would be able to insert
  326. `find outer otter ' into the buffer by typing `f o o SPC'.
  327.  
  328.    A second kind of abbreviation facility is called "dynamic abbrev
  329. expansion".  You use dynamic abbrev expansion with an explicit command
  330. to expand the letters in the buffer before point by looking for other
  331. words in the buffer that start with those letters.  *Note Dynamic
  332. Abbrevs::.
  333.  
  334. * Menu:
  335.  
  336. * Abbrev Concepts::   Fundamentals of defined abbrevs.
  337. * Defining Abbrevs::  Defining an abbrev, so it will expand when typed.
  338. * Expanding Abbrevs:: Controlling expansion: prefixes, canceling expansion.
  339. * Editing Abbrevs::   Viewing or editing the entire list of defined abbrevs.
  340. * Saving Abbrevs::    Saving the entire list of abbrevs for another session.
  341. * Dynamic Abbrevs::   Abbreviations for words already in the buffer.
  342.  
  343. 
  344. File: emacs,  Node: Abbrev Concepts,  Next: Defining Abbrevs,  Up: Abbrevs
  345.  
  346. Abbrev Concepts
  347. ===============
  348.  
  349.    An "abbrev" is a word which has been defined to "expand" into a
  350. specified "expansion".  When you insert a word-separator character
  351. following the abbrev, that expands the abbrev--replacing the abbrev
  352. with its expansion.  For example, if `foo' is defined as an abbrev
  353. expanding to `find outer otter', then you can insert `find outer
  354. otter.'  into the buffer by typing `f o o .'.
  355.  
  356.    Abbrevs expand only when Abbrev mode (a minor mode) is enabled.
  357. Disabling Abbrev mode does not cause abbrev definitions to be forgotten,
  358. but they do not expand until Abbrev mode is enabled again.  The command
  359. `M-x abbrev-mode' toggles Abbrev mode; with a numeric argument, it
  360. turns Abbrev mode on if the argument is positive, off otherwise.  *Note
  361. Minor Modes::.  `abbrev-mode' is also a variable; Abbrev mode is on
  362. when the variable is non-`nil'.  The variable `abbrev-mode'
  363. automatically becomes local to the current buffer when it is set.
  364.  
  365.    Abbrev definitions can be "mode-specific"--active only in one major
  366. mode.  Abbrevs can also have "global" definitions that are active in
  367. all major modes.  The same abbrev can have a global definition and
  368. various mode-specific definitions for different major modes.  A mode
  369. specific definition for the current major mode overrides a global
  370. definition.
  371.  
  372.    Abbrevs can be defined interactively during the editing session.
  373. Lists of abbrev definitions can also be saved in files and reloaded in
  374. later sessions.  Some users keep extensive lists of abbrevs that they
  375. load in every session.
  376.  
  377. 
  378. File: emacs,  Node: Defining Abbrevs,  Next: Expanding Abbrevs,  Prev: Abbrev Concepts,  Up: Abbrevs
  379.  
  380. Defining Abbrevs
  381. ================
  382.  
  383. `C-x a g'
  384.      Define an abbrev, using one or more words before point as its
  385.      expansion (`add-global-abbrev').
  386.  
  387. `C-x a l'
  388.      Similar, but define an abbrev specific to the current major mode
  389.      (`add-mode-abbrev').
  390.  
  391. `C-x a i g'
  392.      Define a word in the buffer as an abbrev
  393.      (`inverse-add-global-abbrev').
  394.  
  395. `C-x a i l'
  396.      Define a word in the buffer as a mode-specific abbrev
  397.      (`inverse-add-mode-abbrev').
  398.  
  399. `M-x kill-all-abbrevs'
  400.      This command discards all abbrev definitions currently in effect,
  401.      leaving a blank slate.
  402.  
  403.    The usual way to define an abbrev is to enter the text you want the
  404. abbrev to expand to, position point after it, and type `C-x a g'
  405. (`add-global-abbrev').  This reads the abbrev itself using the
  406. minibuffer, and then defines it as an abbrev for one or more words
  407. before point.  Use a numeric argument to say how many words before
  408. point should be taken as the expansion.  For example, to define the
  409. abbrev `foo' as mentioned above, insert the text `find outer otter' and
  410. then type `C-u 3 C-x a g f o o RET'.
  411.  
  412.    An argument of zero to `C-x a g' means to use the contents of the
  413. region as the expansion of the abbrev being defined.
  414.  
  415.    The command `C-x a l' (`add-mode-abbrev') is similar, but defines a
  416. mode-specific abbrev.  Mode specific abbrevs are active only in a
  417. particular major mode.  `C-x a l' defines an abbrev for the major mode
  418. in effect at the time `C-x a l' is typed.  The arguments work the same
  419. as for `C-x a g'.
  420.  
  421.    If the text already in the buffer is the abbrev, rather than its
  422. expansion, use command `C-x a i g' (`inverse-add-global-abbrev')
  423. instead of `C-x a g', or use `C-x a i l' (`inverse-add-mode-abbrev')
  424. instead of `C-x a l'.  These commands are called "inverse" because they
  425. invert the meaning of the two text strings they use (one from the
  426. buffer and one read with the minibuffer).
  427.  
  428.    To change the definition of an abbrev, just define a new definition.
  429. When the abbrev has a prior definition, the abbrev definition commands
  430. ask for confirmation for replacing it.
  431.  
  432.    To remove an abbrev definition, give a negative argument to the
  433. abbrev definition command: `C-u - C-x a g' or `C-u - C-x a l'.  The
  434. former removes a global definition, while the latter removes a
  435. mode-specific definition.
  436.  
  437.    `M-x kill-all-abbrevs' removes all the abbrev definitions there are,
  438. both global and local.
  439.  
  440. 
  441. File: emacs,  Node: Expanding Abbrevs,  Next: Editing Abbrevs,  Prev: Defining Abbrevs,  Up: Abbrevs
  442.  
  443. Controlling Abbrev Expansion
  444. ============================
  445.  
  446.    An abbrev expands whenever it is present in the buffer just before
  447. point and you type a self-inserting whitespace or punctuation character
  448. (SPC, comma, etc.).  More precisely, any character that is not a word
  449. constituent expands an abbrev, and any word constituent character can
  450. be part of an abbrev.  The most common way to use an abbrev is to
  451. insert it and then insert a punctuation character to expand it.
  452.  
  453.    Abbrev expansion preserves case; thus, `foo' expands into `find
  454. outer otter'; `Foo' into `Find outer otter', and `FOO' into `FIND OUTER
  455. OTTER' or `Find Outer Otter' according to the variable
  456. `abbrev-all-caps' (a non-`nil' value chooses the first of the two
  457. expansions).
  458.  
  459.    These commands are used to control abbrev expansion:
  460.  
  461. `M-''
  462.      Separate a prefix from a following abbrev to be expanded
  463.      (`abbrev-prefix-mark').
  464.  
  465. `C-x a e'
  466.      Expand the abbrev before point (`expand-abbrev').  This is
  467.      effective even when Abbrev mode is not enabled.
  468.  
  469. `M-x expand-region-abbrevs'
  470.      Expand some or all abbrevs found in the region.
  471.  
  472.    You may wish to expand an abbrev with a prefix attached; for example,
  473. if `cnst' expands into `construction', you might want to use it to
  474. enter `reconstruction'.  It does not work to type `recnst', because
  475. that is not necessarily a defined abbrev.  What you can do is use the
  476. command `M-'' (`abbrev-prefix-mark') in between the prefix `re' and the
  477. abbrev `cnst'.  First, insert `re'.  Then type `M-''; this inserts a
  478. hyphen in the buffer to indicate that it has done its work.  Then
  479. insert the abbrev `cnst'; the buffer now contains `re-cnst'.  Now
  480. insert a non-word character to expand the abbrev `cnst' into
  481. `construction'.  This expansion step also deletes the hyphen that
  482. indicated `M-'' had been used.  The result is the desired
  483. `reconstruction'.
  484.  
  485.    If you actually want the text of the abbrev in the buffer, rather
  486. than its expansion, you can accomplish this by inserting the following
  487. punctuation with `C-q'.  Thus, `foo C-q ,' leaves `foo,' in the buffer.
  488.  
  489.    If you expand an abbrev by mistake, you can undo the expansion and
  490. bring back the abbrev itself by typing `C-_' (`undo').  This also
  491. undoes the insertion of the non-word character that expanded the
  492. abbrev.  If the result you want is the terminating non-word character
  493. plus the unexpanded abbrev, you must reinsert the terminating character,
  494. quoting it with `C-q'.
  495.  
  496.    `M-x expand-region-abbrevs' searches through the region for defined
  497. abbrevs, and for each one found offers to replace it with its expansion.
  498. This command is useful if you have typed in text using abbrevs but
  499. forgot to turn on Abbrev mode first.  It may also be useful together
  500. with a special set of abbrev definitions for making several global
  501. replacements at once.  This command is effective even if Abbrev mode is
  502. not enabled.
  503.  
  504.    Expanding an abbrev runs the hook `pre-abbrev-expand-hook' (*note
  505. Hooks::.).
  506.  
  507. 
  508. File: emacs,  Node: Editing Abbrevs,  Next: Saving Abbrevs,  Prev: Expanding Abbrevs,  Up: Abbrevs
  509.  
  510. Examining and Editing Abbrevs
  511. =============================
  512.  
  513. `M-x list-abbrevs'
  514.      Display a list of all abbrev definitions.
  515.  
  516. `M-x edit-abbrevs'
  517.      Edit a list of abbrevs; you can add, alter or remove definitions.
  518.  
  519.    The output from `M-x list-abbrevs' looks like this:
  520.  
  521.      (lisp-mode-abbrev-table)
  522.      "dk"           0    "define-key"
  523.      (global-abbrev-table)
  524.      "dfn"           0    "definition"
  525.  
  526. (Some blank lines of no semantic significance, and some other abbrev
  527. tables, have been omitted.)
  528.  
  529.    A line containing a name in parentheses is the header for abbrevs in
  530. a particular abbrev table; `global-abbrev-table' contains all the global
  531. abbrevs, and the other abbrev tables that are named after major modes
  532. contain the mode-specific abbrevs.
  533.  
  534.    Within each abbrev table, each nonblank line defines one abbrev.  The
  535. word at the beginning of the line is the abbrev.  The number that
  536. follows is the number of times the abbrev has been expanded.  Emacs
  537. keeps track of this to help you see which abbrevs you actually use, so
  538. that you can eliminate those that you don't use often.  The string at
  539. the end of the line is the expansion.
  540.  
  541.    `M-x edit-abbrevs' allows you to add, change or kill abbrev
  542. definitions by editing a list of them in an Emacs buffer.  The list has
  543. the same format described above.  The buffer of abbrevs is called
  544. `*Abbrevs*', and is in Edit-Abbrevs mode.  Type `C-c C-c' in this
  545. buffer to install the abbrev definitions as specified in the
  546. buffer--and delete any abbrev definitions not listed.
  547.  
  548.    The command `edit-abbrevs' is actually the same as `list-abbrevs'
  549. except that it selects the buffer `*Abbrevs*' whereas `list-abbrevs'
  550. merely displays it in another window.
  551.  
  552. 
  553. File: emacs,  Node: Saving Abbrevs,  Next: Dynamic Abbrevs,  Prev: Editing Abbrevs,  Up: Abbrevs
  554.  
  555. Saving Abbrevs
  556. ==============
  557.  
  558.    These commands allow you to keep abbrev definitions between editing
  559. sessions.
  560.  
  561. `M-x write-abbrev-file RET FILE RET'
  562.      Write a file FILE describing all defined abbrevs.
  563.  
  564. `M-x read-abbrev-file RET FILE RET'
  565.      Read the file FILE and define abbrevs as specified therein.
  566.  
  567. `M-x quietly-read-abbrev-file RET FILE RET'
  568.      Similar but do not display a message about what is going on.
  569.  
  570. `M-x define-abbrevs'
  571.      Define abbrevs from definitions in current buffer.
  572.  
  573. `M-x insert-abbrevs'
  574.      Insert all abbrevs and their expansions into current buffer.
  575.  
  576.    `M-x write-abbrev-file' reads a file name using the minibuffer and
  577. then writes a description of all current abbrev definitions into that
  578. file.  This is used to save abbrev definitions for use in a later
  579. session.  The text stored in the file is a series of Lisp expressions
  580. that, when executed, define the same abbrevs that you currently have.
  581.  
  582.    `M-x read-abbrev-file' reads a file name using the minibuffer and
  583. then reads the file, defining abbrevs according to the contents of the
  584. file.  `M-x quietly-read-abbrev-file' is the same except that it does
  585. not display a message in the echo area saying that it is doing its
  586. work; it is actually useful primarily in the `.emacs' file.  If an
  587. empty argument is given to either of these functions, they use the file
  588. name specified in the variable `abbrev-file-name', which is by default
  589. `"~/.abbrev_defs"'.
  590.  
  591.    Emacs will offer to save abbrevs automatically if you have changed
  592. any of them, whenever it offers to save all files (for `C-x s' or `C-x
  593. C-c').  This feature can be inhibited by setting the variable
  594. `save-abbrevs' to `nil'.
  595.  
  596.    The commands `M-x insert-abbrevs' and `M-x define-abbrevs' are
  597. similar to the previous commands but work on text in an Emacs buffer.
  598. `M-x insert-abbrevs' inserts text into the current buffer before point,
  599. describing all current abbrev definitions; `M-x define-abbrevs' parses
  600. the entire current buffer and defines abbrevs accordingly.
  601.  
  602. 
  603. File: emacs,  Node: Dynamic Abbrevs,  Prev: Saving Abbrevs,  Up: Abbrevs
  604.  
  605. Dynamic Abbrev Expansion
  606. ========================
  607.  
  608.    The abbrev facility described above operates automatically as you
  609. insert text, but all abbrevs must be defined explicitly.  By contrast,
  610. "dynamic abbrevs" allow the meanings of abbrevs to be determined
  611. automatically from the contents of the buffer, but dynamic abbrev
  612. expansion happens only when you request it explicitly.
  613.  
  614. `M-/'
  615.      Expand the word in the buffer before point as a "dynamic abbrev",
  616.      by searching in the buffer for words starting with that
  617.      abbreviation (`dabbrev-expand').
  618.  
  619.    For example, if the buffer contains `does this follow ' and you type
  620. `f o M-/', the effect is to insert `follow' because that is the last
  621. word in the buffer that starts with `fo'.  A numeric argument to `M-/'
  622. says to take the second, third, etc. distinct expansion found looking
  623. backward from point.  Repeating `M-/' searches for an alternative
  624. expansion by looking farther back.  After the entire buffer before
  625. point has been considered, the buffer after point is searched.
  626.  
  627.    A negative argument to `M-/', as in `C-u - M-/', says to search
  628. first for expansions after point, and only later search the text before
  629. point.  If you repeat the `M-/' to look for another expansion, do not
  630. specify an argument.  This tries all the expansions after point and
  631. then the expansions before point.
  632.  
  633.    Dynamic abbrev expansion is completely independent of Abbrev mode;
  634. the expansion of a word with `M-/' is completely independent of whether
  635. it has a definition as an ordinary abbrev.
  636.  
  637. 
  638. File: emacs,  Node: Picture,  Next: Sending Mail,  Prev: Abbrevs,  Up: Top
  639.  
  640. Editing Pictures
  641. ****************
  642.  
  643.    To edit a picture made out of text characters (for example, a picture
  644. of the division of a register into fields, as a comment in a program),
  645. use the command `M-x edit-picture' to enter Picture mode.
  646.  
  647.    In Picture mode, editing is based on the "quarter-plane" model of
  648. text, according to which the text characters lie studded on an area that
  649. stretches infinitely far to the right and downward.  The concept of the
  650. end of a line does not exist in this model; the most you can say is
  651. where the last nonblank character on the line is found.
  652.  
  653.    Of course, Emacs really always considers text as a sequence of
  654. characters, and lines really do have ends.  But Picture mode replaces
  655. the most frequently-used commands with variants that simulate the
  656. quarter-plane model of text.  They do this by inserting spaces or by
  657. converting tabs to spaces.
  658.  
  659.    Most of the basic editing commands of Emacs are redefined by Picture
  660. mode to do essentially the same thing but in a quarter-plane way.  In
  661. addition, Picture mode defines various keys starting with the `C-c'
  662. prefix to run special picture editing commands.
  663.  
  664.    One of these keys, `C-c C-c', is pretty important.  Often a picture
  665. is part of a larger file that is usually edited in some other major
  666. mode.  `M-x edit-picture' records the name of the previous major mode
  667. so you can use the `C-c C-c' command (`picture-mode-exit') later to go
  668. back to that mode.  `C-c C-c' also deletes spaces from the ends of
  669. lines, unless given a numeric argument.
  670.  
  671.    The special commands of Picture mode all work in other modes
  672. (provided the `picture' library is loaded), but are not bound to keys
  673. except in Picture mode.  The descriptions below talk of moving "one
  674. column" and so on, but all the picture mode commands handle numeric
  675. arguments as their normal equivalents do.
  676.  
  677.    Turning on Picture mode runs the hook `picture-mode-hook' (*note
  678. Hooks::.).
  679.  
  680. * Menu:
  681.  
  682. * Basic Picture::         Basic concepts and simple commands of Picture Mode.
  683. * Insert in Picture::     Controlling direction of cursor motion
  684.                             after "self-inserting" characters.
  685. * Tabs in Picture::       Various features for tab stops and indentation.
  686. * Rectangles in Picture:: Clearing and superimposing rectangles.
  687.  
  688. 
  689. File: emacs,  Node: Basic Picture,  Next: Insert in Picture,  Prev: Picture,  Up: Picture
  690.  
  691. Basic Editing in Picture Mode
  692. =============================
  693.  
  694.    Most keys do the same thing in Picture mode that they usually do, but
  695. do it in a quarter-plane style.  For example, `C-f' is rebound to run
  696. `picture-forward-column', a command which moves point one column to the
  697. right, inserting a space if necessary so that the actual end of the
  698. line makes no difference.  `C-b' is rebound to run
  699. `picture-backward-column', which always moves point left one column,
  700. converting a tab to multiple spaces if necessary.  `C-n' and `C-p' are
  701. rebound to run `picture-move-down' and `picture-move-up', which can
  702. either insert spaces or convert tabs as necessary to make sure that
  703. point stays in exactly the same column.  `C-e' runs
  704. `picture-end-of-line', which moves to after the last nonblank character
  705. on the line.  There is no need to change `C-a', as the choice of screen
  706. model does not affect beginnings of lines.
  707.  
  708.    Insertion of text is adapted to the quarter-plane screen model
  709. through the use of Overwrite mode (*note Minor Modes::.).
  710. Self-inserting characters replace existing text, column by column,
  711. rather than pushing existing text to the right.  RET runs
  712. `picture-newline', which just moves to the beginning of the following
  713. line so that new text will replace that line.
  714.  
  715.    Picture mode provides erasure instead of deletion and killing of
  716. text.  DEL (`picture-backward-clear-column') replaces the preceding
  717. character with a space rather than removing it; this moves point
  718. backwards.  `C-d' (`picture-clear-column') replaces the next character
  719. or characters with spaces, but does not move point.  (If you want to
  720. clear characters to spaces and move forward over them, use SPC.)  `C-k'
  721. (`picture-clear-line') really kills the contents of lines, but does not
  722. delete the newlines from the buffer.
  723.  
  724.    To do actual insertion, you must use special commands.  `C-o'
  725. (`picture-open-line') creates a blank line after the current line; it
  726. never splits a line.  `C-M-o', `split-line', makes sense in Picture
  727. mode, so it is not changed.  LFD (`picture-duplicate-line') inserts
  728. below the current line another line with the same contents.
  729.  
  730.    To do actual deletion in Picture mode, use `C-w', `C-c C-d' (which
  731. is defined as `delete-char', as `C-d' is in other modes), or one of the
  732. picture rectangle commands (*note Rectangles in Picture::.).
  733.  
  734. 
  735. File: emacs,  Node: Insert in Picture,  Next: Tabs in Picture,  Prev: Basic Picture,  Up: Picture
  736.  
  737. Controlling Motion after Insert
  738. ===============================
  739.  
  740.    Since "self-inserting" characters in Picture mode overwrite and move
  741. point, there is no essential restriction on how point should be moved.
  742. Normally point moves right, but you can specify any of the eight
  743. orthogonal or diagonal directions for motion after a "self-inserting"
  744. character.  This is useful for drawing lines in the buffer.
  745.  
  746. `C-c <'
  747.      Move left after insertion (`picture-movement-left').
  748.  
  749. `C-c >'
  750.      Move right after insertion (`picture-movement-right').
  751.  
  752. `C-c ^'
  753.      Move up after insertion (`picture-movement-up').
  754.  
  755. `C-c .'
  756.      Move down after insertion (`picture-movement-down').
  757.  
  758. `C-c `'
  759.      Move up and left ("northwest") after insertion
  760.      (`picture-movement-nw').
  761.  
  762. `C-c ''
  763.      Move up and right ("northeast") after insertion
  764.      (`picture-movement-ne').
  765.  
  766. `C-c /'
  767.      Move down and left ("southwest") after insertion
  768.      (`picture-movement-sw').
  769.  
  770. `C-c \'
  771.      Move down and right ("southeast") after insertion
  772.      (`picture-movement-se').
  773.  
  774.    Two motion commands move based on the current Picture insertion
  775. direction.  The command `C-c C-f' (`picture-motion') moves in the same
  776. direction as motion after "insertion" currently does, while `C-c C-b'
  777. (`picture-motion-reverse') moves in the opposite direction.
  778.  
  779. 
  780. File: emacs,  Node: Tabs in Picture,  Next: Rectangles in Picture,  Prev: Insert in Picture,  Up: Picture
  781.  
  782. Picture Mode Tabs
  783. =================
  784.  
  785.    Two kinds of tab-like action are provided in Picture mode.  Use
  786. `M-TAB' (`picture-tab-search') for context-based tabbing.  With no
  787. argument, it moves to a point underneath the next "interesting"
  788. character that follows whitespace in the previous nonblank line.
  789. "Next" here means "appearing at a horizontal position greater than the
  790. one point starts out at."  With an argument, as in `C-u M-TAB', this
  791. command moves to the next such interesting character in the current
  792. line.  `M-TAB' does not change the text; it only moves point.
  793. "Interesting" characters are defined by the variable
  794. `picture-tab-chars', which should define a set of characters.  The
  795. syntax for this variable is like the syntax used inside of `[...]' in a
  796. regular expression--but without the `[' and the `]'.  Its default value
  797. is `"!-~"'.
  798.  
  799.    TAB itself runs `picture-tab', which operates based on the current
  800. tab stop settings; it is the Picture mode equivalent of
  801. `tab-to-tab-stop'.  Normally it just moves point, but with a numeric
  802. argument it clears the text that it moves over.
  803.  
  804.    The context-based and tab-stop-based forms of tabbing are brought
  805. together by the command `C-c TAB', `picture-set-tab-stops'.  This
  806. command sets the tab stops to the positions which `M-TAB' would
  807. consider significant in the current line.  The use of this command,
  808. together with TAB, can get the effect of context-based tabbing.  But
  809. `M-TAB' is more convenient in the cases where it is sufficient.
  810.  
  811. 
  812. File: emacs,  Node: Rectangles in Picture,  Prev: Tabs in Picture,  Up: Picture
  813.  
  814. Picture Mode Rectangle Commands
  815. ===============================
  816.  
  817.    Picture mode defines commands for working on rectangular pieces of
  818. the text in ways that fit with the quarter-plane model.  The standard
  819. rectangle commands may also be useful (*note Rectangles::.).
  820.  
  821. `C-c C-k'
  822.      Clear out the region-rectangle with spaces
  823.      (`picture-clear-rectangle').  With argument, delete the text.
  824.  
  825. `C-c C-w R'
  826.      Similar but save rectangle contents in register R first
  827.      (`picture-clear-rectangle-to-register').
  828.  
  829. `C-c C-y'
  830.      Copy last killed rectangle into the buffer by overwriting, with
  831.      upper left corner at point (`picture-yank-rectangle').  With
  832.      argument, insert instead.
  833.  
  834. `C-c C-x R'
  835.      Similar, but use the rectangle in register R
  836.      (`picture-yank-rectangle-from-register').
  837.  
  838.    The picture rectangle commands `C-c C-k' (`picture-clear-rectangle')
  839. and `C-c C-w' (`picture-clear-rectangle-to-register') differ from the
  840. standard rectangle commands in that they normally clear the rectangle
  841. instead of deleting it; this is analogous with the way `C-d' is changed
  842. in Picture mode.
  843.  
  844.    However, deletion of rectangles can be useful in Picture mode, so
  845. these commands delete the rectangle if given a numeric argument.  `C-c
  846. C-k' either with or without a numeric argument saves the rectangle for
  847. `C-c C-y'.
  848.  
  849.    The Picture mode commands for yanking rectangles differ from the
  850. standard ones in overwriting instead of inserting.  This is the same way
  851. that Picture mode insertion of other text differs from other modes.
  852. `C-c C-y' (`picture-yank-rectangle') inserts (by overwriting) the
  853. rectangle that was most recently killed, while `C-c C-x'
  854. (`picture-yank-rectangle-from-register') does likewise for the
  855. rectangle found in a specified register.
  856.  
  857. 
  858. File: emacs,  Node: Sending Mail,  Next: Rmail,  Prev: Picture,  Up: Top
  859.  
  860. Sending Mail
  861. ************
  862.  
  863.    To send a message in Emacs, you start by typing a command (`C-x m')
  864. to select and initialize the `*mail*' buffer.  Then you edit the text
  865. and headers of the message in this buffer, and type another command
  866. (`C-c C-c') to send the message.
  867.  
  868. `C-x m'
  869.      Begin composing a message to send (`mail').
  870.  
  871. `C-x 4 m'
  872.      Likewise, but display the message in another window
  873.      (`mail-other-window').
  874.  
  875. `C-x 5 m'
  876.      Likewise, but make a new frame (`mail-other-frame').
  877.  
  878. `C-c C-c'
  879.      In Mail mode, send the message and switch to another buffer
  880.      (`mail-send-and-exit').
  881.  
  882.    The command `C-x m' (`mail') selects a buffer named `*mail*' and
  883. initializes it with the skeleton of an outgoing message.  `C-x 4 m'
  884. (`mail-other-window') selects the `*mail*' buffer in a different
  885. window, leaving the previous current buffer visible.  `C-x 5 m'
  886. (`mail-other-frame') creates a new frame to select the `*mail*' buffer.
  887.  
  888.    Because the mail composition buffer is an ordinary Emacs buffer, you
  889. can switch to other buffers while in the middle of composing mail, and
  890. switch back later (or never).  If you use the `C-x m' command again
  891. when you have been composing another message but have not sent it, you
  892. are asked to confirm before the old message is erased.  If you answer
  893. `n', the `*mail*' buffer is left selected with its old contents, so you
  894. can finish the old message and send it.  `C-u C-x m' is another way to
  895. do this.  Sending the message marks the `*mail*' buffer "unmodified",
  896. which avoids the need for confirmation when `C-x m' is next used.
  897.  
  898.    If you are composing a message in the `*mail*' buffer and want to
  899. send another message before finishing the first, rename the `*mail*'
  900. buffer using `M-x rename-uniquely' (*note Misc Buffer::.).  Then you
  901. can use `C-x m' or its variants described above to make a new `*mail'
  902. buffer.  Once you've done that, you can work with each mail buffer
  903. independently.
  904.  
  905. * Menu:
  906.  
  907. * Format: Mail Format.         Format of the mail being composed.
  908. * Headers: Mail Headers.     Details of permitted mail header fields.
  909. * Aliases: Mail Aliases.     Abbreviating and grouping mail addresses.
  910. * Mode: Mail Mode.         Special commands for editing mail being composed.
  911. * Spook: Distracting NSA.    How to distract the NSA's attention.
  912.  
  913. 
  914. File: emacs,  Node: Mail Format,  Next: Mail Headers,  Up: Sending Mail
  915.  
  916. The Format of the Mail Buffer
  917. =============================
  918.  
  919.    In addition to the "text" or "body", a message has "header fields"
  920. which say who sent it, when, to whom, why, and so on.  Some header
  921. fields such as the date and sender are created automatically after the
  922. message is sent.  Others, such as the recipient names, must be
  923. specified by you in order to send the message properly.
  924.  
  925.    Mail mode provides a few commands to help you edit some header
  926. fields, and some are preinitialized in the buffer automatically at
  927. times.  You can insert and edit header fields using ordinary editing
  928. commands.
  929.  
  930.    The line in the buffer that says
  931.  
  932.      --text follows this line--
  933.  
  934. is a special delimiter that separates the headers you have specified
  935. from the text.  Whatever follows this line is the text of the message;
  936. the headers precede it.  The delimiter line itself does not appear in
  937. the message actually sent.  The text used for the delimiter line is
  938. controlled by the variable `mail-header-separator'.
  939.  
  940.    Here is an example of what the headers and text in the `*mail*'
  941. buffer might look like.
  942.  
  943.      To: gnu@prep.ai.mit.edu
  944.      CC: lungfish@spam.org, byob@spam.org
  945.      Subject: The Emacs Manual
  946.      --Text follows this line--
  947.      Please ignore this message.
  948.  
  949. 
  950. File: emacs,  Node: Mail Headers,  Next: Mail Aliases,  Prev: Mail Format,  Up: Sending Mail
  951.  
  952. Mail Header Fields
  953. ==================
  954.  
  955.    A header field in the `*mail*' buffer starts with a field name at
  956. the beginning of a line, terminated by a colon.  Upper and lower case
  957. are equivalent in field names (and in mailing addresses also).  After
  958. the colon and optional whitespace comes the contents of the field.
  959.  
  960.    You can use any name you like for a header field, but normally people
  961. use only standard field names with accepted meanings.  Here is a table
  962. of fields commonly used in outgoing messages.
  963.  
  964. `To'
  965.      This field contains the mailing addresses to which the message is
  966.      addressed.
  967.  
  968. `Subject'
  969.      The contents of the `Subject' field should be a piece of text that
  970.      says what the message is about.  The reason `Subject' fields are
  971.      useful is that most mail-reading programs can provide a summary of
  972.      messages, listing the subject of each message but not its text.
  973.  
  974. `CC'
  975.      This field contains additional mailing addresses to send the
  976.      message to, but whose readers should not regard the message as
  977.      addressed to them.
  978.  
  979. `BCC'
  980.      This field contains additional mailing addresses to send the
  981.      message to, which should not appear in the header of the message
  982.      actually sent.  Copies sent this way are called "blind carbon
  983.      copies".
  984.  
  985.      To send a blind carbon copy of every outgoing message to yourself,
  986.      set the variable `mail-self-blind' to `t'.
  987.  
  988. `FCC'
  989.      This field contains the name of one file (in system mail file
  990.      format) to which a copy of the message should be appended when the
  991.      message is sent.  Do not output directly into an Rmail file with
  992.      `FCC'; instead, output to an inbox file and "get new mail" from
  993.      that inbox file into the Rmail file.  *Note Rmail Inbox::.
  994.  
  995.      To put a fixed file name as in `FCC' field each time you start
  996.      editing an outgoing message, set the variable
  997.      `mail-archive-file-name' to that file name.  Unless you remove the
  998.      `FCC' field before sending, the message will be written into that
  999.      file when it is sent.
  1000.  
  1001. `From'
  1002.      Use the `From' field to say who you are, when the account you are
  1003.      using to send the mail is not your own.  The contents of the
  1004.      `From' field should be a valid mailing address, since replies will
  1005.      normally go there.
  1006.  
  1007. `Reply-to'
  1008.      Use this field to direct replies to a different address.  Most
  1009.      mail-reading programs (including Rmail) automatically send replies
  1010.      to the `Reply-to' address in preference to the `From' address.  By
  1011.      adding a `Reply-to' field to your header, you can work around any
  1012.      problems your `From' address may cause for replies.
  1013.  
  1014.      To put a fixed `Reply-to' address into every outgoing message, set
  1015.      the variable `mail-default-reply-to' to that address (as a string).
  1016.      Then `mail' initializes the message with a `Reply-to' field as
  1017.      specified.  You can delete or alter that header field before you
  1018.      send the message, if you wish.
  1019.  
  1020. `In-reply-to'
  1021.      This field contains a piece of text describing a message you are
  1022.      replying to.  Some mail systems can use this information to
  1023.      correlate related pieces of mail.  Normally this field is filled
  1024.      in by Rmail when you reply to a message in Rmail, and you never
  1025.      need to think about it (*note Rmail::.).
  1026.  
  1027.    The `To', `CC', `BCC' and `FCC' fields can appear any number of
  1028. times, to specify many places to send the message.  The `To', `CC', and
  1029. `BCC' fields can have continuation lines.  All the lines starting with
  1030. whitespace, following the line on which the field starts, are
  1031. considered part of the field.  For example,
  1032.  
  1033.      To: foo@here.net, this@there.net,
  1034.        me@gnu.cambridge.mass.usa.earth.spiral3281
  1035.  
  1036. 
  1037. File: emacs,  Node: Mail Aliases,  Next: Mail Mode,  Prev: Mail Headers,  Up: Sending Mail
  1038.  
  1039. Mail Aliases
  1040. ============
  1041.  
  1042.    You can define "mail aliases" in a file named `~/.mailrc'.  These
  1043. are short mnemonic names which stand for mail addresses or groups of
  1044. mail addresses.  Like many other mail programs, Emacs expands aliases
  1045. when they occur in the `To', `CC', and `BCC' fields.
  1046.  
  1047.    To define an alias in `~/.mailrc', write a line in the following
  1048. format:
  1049.  
  1050.      alias SHORTADDRESS FULLADDRESSES
  1051.  
  1052. Here FULLADDRESSES stands for one or more mail addresses for
  1053. SHORTADDRESS to expand into.  Separate multiple addresses with spaces;
  1054. if an address contains a space, quote the whole address with a pair of
  1055. double-quotes.
  1056.  
  1057.    For instance, to make `maingnu' stand for `gnu@prep.ai.mit.edu' plus
  1058. a local address of your own, put in this line:
  1059.  
  1060.      alias maingnu gnu@prep.ai.mit.edu local-gnu
  1061.  
  1062.    Emacs also recognizes include commands in `.mailrc' files.  They
  1063. look like this:
  1064.  
  1065.      source FILENAME
  1066.  
  1067. The file `~/.mailrc' is used primarily by other mail-reading programs;
  1068. it can contain various other commands.  Emacs ignores everything in it
  1069. except for alias definitions and include commands.
  1070.  
  1071.    Another way to define a mail alias, within Emacs alone, is with the
  1072. `define-mail-alias' command.  It prompts for the alias and then the
  1073. full address.  You can use it to define aliases in your `.emacs' file,
  1074. like this:
  1075.  
  1076.      (define-mail-alias "maingnu" "gnu@prep.ai.mit.edu")
  1077.  
  1078.    `define-mail-alias' records aliases by adding them to a variable
  1079. named `mail-aliases'.  If you are comfortable with manipulating Lisp
  1080. lists, you can set `mail-aliases' directly.  The initial value of
  1081. `mail-aliases' is `t', which means that Emacs should read `.mailrc' to
  1082. get the proper value.
  1083.  
  1084.    Normally, Emacs expands aliases when you send the message.  If you
  1085. like, you can have mail aliases expand as abbrevs, as soon as you type
  1086. them in.  To enable this feature, execute the following:
  1087.  
  1088.      (add-hook 'mail-setup-hook 'mail-abbrevs-setup)
  1089.  
  1090. This can go in your `.emacs' file.  *Note Hooks::.  If you use this
  1091. feature, you must use `define-mail-abbrev' instead of
  1092. `define-mail-alias'; the latter does not work with this package.  Also,
  1093. the mail abbreviation package uses the variable `mail-abbrevs' instead
  1094. of `mail-aliases'.
  1095.  
  1096.    Note that abbrevs expand only if you insert a word-separator
  1097. character afterward.  However, any mail aliases that you didn't expand
  1098. in the mail buffer are expanded subsequently when you send the message.
  1099. *Note Abbrevs::.
  1100.  
  1101.